#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<cstdio>

using namespace std;

int main()
{
    int N, count, C = 0, R = 0, F = 0;
    double coneys, rats, frogs;
    cin >> N;
    char c;
    for (int i = 0; i < N; i++)
    {
        cin >> count >> c;
        if (c == 'C')
            C += count;
        else if (c == 'R')
            R += count;
        else if (c == 'F')
            F += count;
    }
    printf("Total: %d animals\n", R + C + F);
    printf("Total coneys: %d\n", C);
    printf("Total rats: %d\n", R);
    printf("Total frogs: %d\n", F);
    frogs = 100.0 * F / (R + C + F);
    rats = 100.0 * R / (R + C + F);
    coneys = 100.0 * C / (R + C + F);
    printf("Percentage of coneys: %.2lf %%\nPercentage of rats: %.2lf %%\nPercentage of frogs: %.2lf %%\n", coneys, rats, frogs);
    return 0;
}
